import { Module } from '@nestjs/common';
import { AmqpController } from './amqp.controller';
import { AmqpService } from './amqp.service';
import { AmqpClientModule } from '@app/amqp-client';
import { CacheModule } from '@app/cache';
import { ConfigureModule } from '@app/configure';

@Module({
	imports: [
		ConfigureModule.forRoot(),
		CacheModule,
		AmqpClientModule.forRootAsync({
			// imports : [C],
			// inject : [DbService],
			useFactory : () => {
				return {
					uid : '1952692044721026', //账号id 您可登录物联网平台控制台，移动鼠标指针到账号头像，查看账号ID。
					accessKeyId : 'LTAI5tBNbKSkg4rAsqDhvogt',
					accessKeySecret : '5KjRP77kbyYN9OxdFdWEvVYmvwrYQe',
					regionId : 'cn-shanghai', //请替换为您的物联网平台设备所在地域的Region ID。Region ID表达方法，请参见支持的地域。
					consumerGroupId : 'omBz5bn4QU8g0vjOldTT000100',
				}
			},
		
			// dataSourceFactory: async (options) => {
			// 	const dataSource = await new DataSource(options).initialize();
			// 	return dataSource;
			// },
		}),
	],
	controllers: [AmqpController],
	providers: [AmqpService],
})
export class AmqpModule {}
